﻿// <copyright file="VisualCollectionImporter.cs" company="Gravity Age Studios">
// Code released under the MIT license (see License.txt).
// </copyright>
// <author>Vicente Cartas Espinel</author>
// <email>vicente.cartas@gmail.com</email>
namespace LightSwitchApplication.Import
{
    using System;
    using System.IO;
    using Microsoft.LightSwitch;
    using Microsoft.LightSwitch.Framework;
    using Microsoft.LightSwitch.Framework.Client;

    public abstract class VisualCollectionImporter<T> : BaseImporter<T> where T : class, IEntityObject
    {
        protected VisualCollectionImporter(DataWorkspace workspace)
            : base(workspace)
        {
        }

        public void ImportData(Stream stream, VisualCollection<T> collection)
        {
            this.builder = () => collection.AddNew();
            this.ImportData(stream);
        }
    }
}
